]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
notificationDaemon: Do not send activation event multiple times
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 7 Oct 2025 18:08:39 +0000 (20:08 +0200)
committerMarge Bot <marge-bot@gnome.org>
Tue, 14 Oct 2025 11:59:16 +0000 (11:59 +0000)
When a FDO notification is updated we reuse the previous instance,
however we do not care about disconnecting the default activation signal
and thus we may end up emitting the same multiple times, even in the
case the updated notification has no action at all.

So track the signal connections.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3904>

js/ui/notificationDaemon.js

index 3d9edaceb78e9325feee69a5eb41da6bbc9c2dc1..de99e158d6b407431343ce0987adce81f1c5a60d 100644 (file)
@@ -193,6 +193,7 @@ class FdoNotificationDaemon {
                     break;
                 }
                 this._emitNotificationClosed(id, notificationClosedReason);
+                notification.disconnectObject(this);
             });
         }
 
@@ -210,6 +211,7 @@ class FdoNotificationDaemon {
             acknowledged: false,
         });
         notification.clearActions();
+        notification.disconnectObject(this);
 
         let hasDefaultAction = false;
 
@@ -228,14 +230,14 @@ class FdoNotificationDaemon {
         }
 
         if (hasDefaultAction) {
-            notification.connect('activated', () => {
+            notification.connectObject('activated', () => {
                 this._emitActivationToken(source, id);
                 this._emitActionInvoked(id, 'default');
-            });
+            }, this);
         } else {
-            notification.connect('activated', () => {
+            notification.connectObject('activated', () => {
                 source.open();
-            });
+            }, this);
         }
 
         switch (hints.urgency) {